<%@page contentType="text/html" pageEncoding="UTF-8"%>
<div id="buildReportModal" class="modal hide fade">
    <form action="/report/build.html" target="_blank">
        <input type="hidden" name="patientId" value="${user.id}"/>
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h3>Построить отчет</h3>
        </div>
        <div class="modal-body">
            <p> Построить отчет от
                <div class="input-append date" id="dateStartReport" data-date-format="dd.mm.yyyy">
                    <input size="16" type="text" name="dateStartReport">
                    <span class="add-on"><i class="icon-th"></i></span>
                </div> до
                <div class="input-append date" id="dateEndReport" data-date-format="dd.mm.yyyy">
                    <input size="16" type="text" name="dateEndReport">
                    <span class="add-on"><i class="icon-th"></i></span>
                </div>
            </p>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal" type="submit">Построить</button>
            <button class="btn" data-dismiss="modal" aria-hidden="true">Отмена</button>
        </div>
        <script>
            function buildReport(patientId) {
                $("#buildReportModal input[name=patientId]").val(patientId);
                $("#buildReportModal").modal('show');
            }

            $(function() {
                $("#dateStartReport").datetimepicker({
                    minView: 2,
                    autoclose: true,
                    language: "${pageContext.response.locale == 'ru' || pageContext.response.locale == 'ua' ? 'ru' : 'en'}"
                });

                $("#dateEndReport").datetimepicker({
                    minView: 2,
                    autoclose: true,
                    language: "${pageContext.response.locale == 'ru' || pageContext.response.locale == 'ua' ? 'ru' : 'en'}"
                });

                $("#buildReportModal button[type=submit]").click(function() {
                    $("#buildReportModal form").submit();
                });
            });
        </script>
    </form>
</div>